import type { Router } from 'vue-router'
import { NANOID, getCache, setCache } from '@own-basic-component/util'

const key = `router_${NANOID()}`

/**
 * 设置router信息
 * @param router 路由信息
 */
export function setRouter(router: Router) {
  return setCache<Router>(key, router)
}

/**
 * 获取router信息
 */
export function getRouter() {
  return getCache<Router>(key)
}
